<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>定义对象的简洁方式</title>
</head>
<body>
  <script>
    let name = 'zs';
    let age = 20;

    let obj = {
      name:name,
      age:age
    };
    //声明后的显示效果
    // let obj = {name:'zs',age:20};
    console.log(obj.name);//zs

    //简介方式
    let obj1 = {
      name,
      age,
    }
    console.log(obj1.name,obj.age);//zs 20
  </script>
</body>
</html>